/*!
 * @file model.hh
 * @brief Obiekt do ładowania modelu z pliku 3ds
 */

#ifndef __ENGINE_BASIC_MODEL_HH
#define __ENGINE_BASIC_MODEL_HH

#include <string>
#include <fstream>
#include <iostream>
#include <list>

#include "engine/basic/point3f.hh"
#include "engine/pawirr.hh"

class modelFace {
public:
	int vert1, text1, norm1;
	int vert2, text2, norm2;
	int vert3, text3, norm3;
private:
};

class modelMass {
public:
	point3f position;
	float weigth;
private:
};

class modelData {
public:
	modelData(std::string g, std::string sg);

	void fillVBO();

	std::list<point3f> lVert;
	std::list<point3f> lNorm;
	std::list<point3f> lTexCoord;
	std::list<modelFace> lFace;
	std::string group, subgroup, material;
	GLuint vbo[3];
	GLuint vao;

	point3f sizePlus;
	point3f sizeMinus;

	int totalVertCount;
	shader *shaderProgram;
private:

};

class model {
public:
	/*!
	 * @brief Konstruktor
	 * @param path Adres pliku
	 * @return Obiekt
	 */
	model(std::string path);

	void draw(bool drawBox) const;
	texture *tx;

	point3f getSize() const;

	const std::list<modelMass*> *getMassList() const;

private:
	void loadObj();
	void loadMass();

	std::list<modelMass*> mass;
	std::list<modelData*> data;
	std::string path;

};

#else
class model;
#endif
